//
//  HPRegisterSuccessViewController.m
//  HPZZTong
//
//  Created by Handpay on 14-3-26.
//  Copyright (c) 2014年 Handpay. All rights reserved.
//

#import "HPRegisterSuccessViewController.h"

@interface HPRegisterSuccessViewController ()
@property (retain, nonatomic) IBOutlet UILabel *successTitle;
@property(nonatomic, retain)NSArray* dataArray;
@end

@implementation HPRegisterSuccessViewController


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.showBackButton = NO;
        self.canSave = YES;
    }
    return self;
}

- (void)viewDidLoad
{
    self.title = @"注册成功";
    [super viewDidLoad];
    
    
    self.dataArray = @[@{kDes: @"账号:", kValue:[self.screenData objectForKey:KEY_ACCOUNT]},
                       @{kDes: @"手机号码:", kValue:[self.screenData objectForKey:@"mobile"]}];
    
    self.registerTableView.dataSource = self;
    
    [self.submitButton setBackgroundImage:[[UIImage imageNamed:@"bluebutton.png"] stretchableImageWithLeftCapWidth:9 topCapHeight:0] forState:UIControlStateNormal];
    
    [self.submitButton setBackgroundImage:[[UIImage imageNamed:@"bluebuttonhover.png"] stretchableImageWithLeftCapWidth:9 topCapHeight:0] forState:UIControlStateHighlighted];
    
    [self.experienceButton setBackgroundImage:[[UIImage imageNamed:@"yellowbutton.png"] stretchableImageWithLeftCapWidth:9 topCapHeight:0] forState:UIControlStateNormal];
    
    [self.experienceButton setBackgroundImage:[[UIImage imageNamed:@"yellowbuttonhover.png"] stretchableImageWithLeftCapWidth:9 topCapHeight:0] forState:UIControlStateHighlighted];
    
    if (kVerChannel == VerChannelHeXin) {
        self.successTitle.textColor = kTitleTipsColor;
    }
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSDictionary* infoDic = [self.dataArray objectAtIndex:indexPath.row];
    
    UITableViewCell* cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    
    UILabel* desLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, 90, 44)];
    desLabel.textColor = kNormalFontColor;
    desLabel.font = kNormalFont;
    desLabel.text = [infoDic objectForKey:kDes];
    [cell addSubview:desLabel];
    [desLabel release];
    
    UILabel* valueLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 0, 200, 44)];
    valueLabel.textColor = kNormalFontColor;
    valueLabel.font = kNormalFont;
    valueLabel.text = [infoDic objectForKey:kValue];
    [cell addSubview:valueLabel];
    [valueLabel release];
    
    return [cell autorelease];
}

- (void)dealloc {
    
    self.dataArray = nil;
    [_registerTableView release];
    
    [_submitButton release];
    [_experienceButton release];
    [_successTitle release];
    [super dealloc];
}

- (void)viewDidUnload {
    [self setRegisterTableView:nil];
    [self setSubmitButton:nil];
    [self setExperienceButton:nil];
    [super viewDidUnload];
}

- (IBAction)sumbitButtonClick:(id)sender {

    [ZZT_CLIENG submitQuality];
}

- (IBAction)experienceButtonClick:(id)sender {
    self.canSave = NO;
    [HPUIENG showIndex:1];
}
@end
